package com.dragon.lambda;

import java.util.function.Supplier;

/**
 * @author dragon
 * @version V1.0.0-RELEASE
 * @date 2019/5/30 16:01
 */
public class Hello {

    private String s = "as";

    Runnable r1 = () -> System.out.println(this);
    Runnable r2 = () -> System.out.println(toString());

    Runnable r3 = new Runnable() {
        @Override
        public void run() {
            System.out.println(this);
        }
    };

    @Override
    public String toString() {
        return "Hello, world";
    }

    public static void main(String[] args) {
        Hello hello = new Hello();
        System.out.println(hello.toString());
        Hello hello1 = new Hello();
        hello1.r1.run();
        hello1.r2.run();
//        hello1.r3.run();
        hello1.test();
    }

    public void test() {
        int i = 10;
        Runnable runnable = () -> {
            int v = i;
            System.out.println(v++);
        };
        runnable.run();
    }
}
